#ifndef DEFLATORSOURCE_H_
#define DEFLATORSOURCE_H_

#include <iostream>
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/concepts.hpp>  // sink
#include "zlib.h"

#define DEFAULT_DEFLATOR_SOURCE_CHUNK_SIZE 16384

using namespace std;

namespace phnq
{
	namespace kit
	{
		namespace compression
		{
			class DeflatorSource : public boost::iostreams::source
			{
				public:
					DeflatorSource(istream *is, int level=-1, int chunkSize=DEFAULT_DEFLATOR_SOURCE_CHUNK_SIZE);
					streamsize read(char* s, streamsize n);
				
				private:
					istream *is;
					int chunkSize;
					z_stream strm;
					int ret, flush;
				    unsigned have;
					unsigned char* in;
			};
		}
	}
}

#endif // DEFLATORSOURCE_H_
